/*
********************************************************************************
* Copyright (C) 2021, xiang.D <dx_65535@163.com>.
* All right reserved.
*
* File Name   : plan.cc
* Author      :
* Version     : V1.0
* Description :
* Journal     : 2021-01-08 init v1.0
* Brief       : Blog: https://blog.csdn.net/qq_38750572?spm=1001.2014.3001.5343
* Others      :
********************************************************************************
*/
#include <stdio.h>
#include "plan.h"
#include "whether_manager.h"
#include "route_manager.h"
#include "equipment_manager.h"

#define PLAN_LOGE(fmt, args...) printf("%d PLAN E: " fmt, __LINE__, ##args)
#define PLAN_LOG(fmt, args...)  printf(fmt, ##args)

int CPlan::TravelPlan(int startDay, int endDay, std::string place)
{
    CWhetherManager   *theWhetherManager   = CWhetherManager::GetInstance();
    CRouteManager     *theRouteManager     = CRouteManager::GetInstance();
    CEquipmentManager *theEquipmentManager = CEquipmentManager::GetInstance();

    if (mCurPlace.empty())
    {
        PLAN_LOGE("Current place is empty\n");
        return -1;
    }

    PLAN_LOG("---------------  Travel Plan  --------------- \n"
             "- Place : %s -> %s                 \n"
             "- Time  : %s -> %s                 \n"
             "- Wheher: %s(%s)                   \n"
             "- Route : %s                       \n"
             "- Prepare Equipment: %s            \n",
             GetCurPlace().c_str(), place.c_str(),
             std::__cxx11::to_string(startDay).c_str(), std::__cxx11::to_string(endDay).c_str(),
             theWhetherManager->GetDuringWeather(startDay, endDay, place).c_str(), place.c_str(),
             theRouteManager->GetRoutePlan(mCurPlace, place).c_str(),
             theEquipmentManager->GetEquipment(startDay, endDay, place).c_str()
    );
    return 0;
}
